//
//  EAD_AppExtendView.m
//  EpointFrame5
//
//  Created by 李亚春 on 14-6-18.
//  Copyright (c) 2014年 Epoint. All rights reserved.
//

#import "EAD_AppExtendView.h"

@implementation EAD_AppExtendView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        CGFloat iconWidth = 40;
        self.ivIcon = [[HJManagedImageV alloc]initWithFrame:CGRectMake(frame.size.width/2-iconWidth/2, 15, iconWidth, iconWidth)];
        self.lbTitle = [[UILabel alloc]initWithFrame:CGRectMake(0, iconWidth+15+10, frame.size.width, 20)];
        self.lbTitle.backgroundColor = [UIColor clearColor];
        [self.lbTitle setFont:[UIFont systemFontOfSize:12]];
        self.lbTitle.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.ivIcon];
        [self addSubview:self.lbTitle];
    }
    return self;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesBegan:touches withEvent:event];
    [self setBackgroundColor:COLOR(217, 217, 217)];
}

-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesCancelled:touches withEvent:event];
    [self setBackgroundColor:[UIColor clearColor]];
    [self setAlpha:1];
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesEnded:touches withEvent:event];
    [self setBackgroundColor:[UIColor clearColor]];
    [self setAlpha:1];
    self.handler();
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
